package com.app.service;

import com.app.mapper.AppInfoMapper;
import com.app.pojo.AppInfo;
import com.app.pojo.AppVersion;
import com.app.pojo.ParamVO;
import com.app.utill.PageBean;
import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Appinfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AppInfoServiceImpl implements AppInfoService {
    @Resource
    private AppInfoMapper appInfoMapper;
    @Override
    public PageBean<AppInfo> getAppList(ParamVO paramVO) {
        PageBean<AppInfo> pages = new PageBean<>();
        pages.setPageSize(paramVO.getPageSize());
        pages.setCurrentPage(pages.getCurrentPage());
        paramVO.setStartIndex(paramVO.getPageIndex());
        //总记录数
        pages.setTotalCount(appInfoMapper.getAppCount(paramVO));
        pages.setResult(appInfoMapper.getAppList(paramVO));
        return pages;
    }

    @Override
    public boolean addversionsave(AppVersion appVersion) {
        if (appInfoMapper.addversionsave(appVersion)>0){
            return true;
        }
        return false;
    }

    @Override
    public AppInfo addview(Integer appinfoid) {
        return appInfoMapper.addview(appinfoid);
    }

    @Override
    public List<Appinfo> getAppversion(Integer appinfoid) {
        return appInfoMapper.getAppversion(appinfoid);
    }

    @Override
    public List<Appinfo> getAppversion2(Integer appinfoid) {
        return appInfoMapper.getAppversion2(appinfoid);
    }
}
